//
//  PhotoCollectionViewCell.m
//  FNer
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 刘志强. All rights reserved.
//

#import "PhotoCollectionViewCell.h"
#import "DetailHtworld.h"
#import "BaseModel.h"
@interface PhotoCollectionViewCell ()

@property(nonatomic,retain)UIImageView *aimageView;
@property(nonatomic,retain)UILabel *aLabel;
@property(nonatomic,retain)UIImageView *bimageView;

@end


@implementation PhotoCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setRootCell];
    }
    return self;
}

-(void)setRootCell
{
    self.aimageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 172 * XWIDTH, 180 * XHIGHT)];
    self.aimageView.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    [self.contentView addSubview:self.aimageView];
    
    self.aLabel = [[UILabel alloc] initWithFrame:CGRectMake(30 * XWIDTH, 180 * XHIGHT, (172 - 30) * XWIDTH, 30 * XHIGHT)];
    [self.contentView addSubview:self.aLabel];
    
    self.bimageView = [[UIImageView alloc] initWithFrame:CGRectMake(5 * XWIDTH, 185 * XHIGHT, 20 * XWIDTH, 20 * XHIGHT)];
    self.bimageView.layer.masksToBounds = YES;
    self.bimageView.layer.cornerRadius = 10 * XWIDTH;
    [self.contentView addSubview:self.bimageView];
}

-(void)setAhtWord:(DetailHtworld *)ahtWord
{
    _ahtWord = ahtWord;
    if (![self.ahtWord.review isEqualToString:@""]) {
        self.aLabel.text = self.ahtWord.review;
    }
    else if([self.ahtWord.review isEqualToString:@""])
    {
        self.aLabel.text = self.ahtWord.worldDesc;
    }
    [self.aLabel setTextColor:[UIColor grayColor]];
    self.aLabel.font = [UIFont systemFontOfSize:14 * XHIGHT];
    [self.aimageView sd_setImageWithURL:[NSURL URLWithString:self.ahtWord.titleThumbPath]];
    
    BaseModel *auser = [[BaseModel alloc] init];
    [auser setValuesForKeysWithDictionary:self.ahtWord.userInfo];
    NSString *userAvatarL = auser.userAvatarL;
    [self.bimageView sd_setImageWithURL:[NSURL URLWithString:userAvatarL]];
}




@end
